public class MyComparable implements Comparable<MyComparable> {
    private Cat cat;

    public Cat getCat() {
        return cat;
    }

    @Override
    public String toString() {
        return "MyComparable{" +
                "cat=" + cat +
                '}';
    }

    public void setCat(Cat cat) {
        this.cat = cat;
    }

    @Override
    public int compareTo(MyComparable o) {
        return cat.getAge().compareTo(o.getCat().getAge());
    }

    public MyComparable(Cat cat) {
        this.cat = cat;
    }

}
